package com.ruoyi.algorithm.repository;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.algorithm.entity.Operator;
import com.ruoyi.algorithm.mapper.OperatorMapper;
import com.ruoyi.algorithm.model.ManufacturerOperatorDDBModel;
import com.ruoyi.algorithm.model.OperatorModel;
import com.beihu.sightplus.common.repository.BaseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class OperatorRepository extends BaseRepository<OperatorMapper, Operator> {

    @Autowired
    private OperatorMapper operatorMapper;

    /**
     * 查询厂商和算子信息，支持根据算子名称
     */
    public List<ManufacturerOperatorDDBModel> getManufacturerOperatorDDB(String operatorName) {
        return operatorMapper.getManufacturerOperatorDDB(operatorName);
    }

    /**
     * 查询分页数据
     */
    public Page<OperatorModel> listByPage(List<Map<String, Object>> list, String orderAttr, String orderType, Long current, Long size) {
        IPage<OperatorModel> page = new Page<>(current, size);
        return operatorMapper.listByPage(page, list, orderAttr, orderType);
    }
}
